package net.orange.architecture.audit;

import net.orange.console.schedule.JobRuntimeStatus;

/**
 * The schedule job information
 */
public class JobInfo implements IAuditInfo {

	/**
	 * The job name
	 */
	private String jobName;

	/**
	 * The job run time status.
	 */
	private JobRuntimeStatus status;

	/**
	 * The job detail message.
	 */
	private String detailMessage;

	/**
	 * The constructor with the job name , status, and detail message.
	 * 
	 * @param jobName
	 *            The job name
	 * @param status
	 *            The job run time status.
	 * @param detailMessage
	 *            The detail message.
	 */
	public JobInfo(String jobName, JobRuntimeStatus status, String detailMessage) {
		this.jobName = jobName;
		this.status = status;
		this.detailMessage = detailMessage;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see net.orange.architecture.audit.IAuditInfo#toInfo()
	 */
	public String toInfo() {
		return "Job "
				+ jobName
				+ " "
				+ status.name()
				+ ((detailMessage != null && detailMessage.length() > 0) ? ": "
						+ detailMessage : "");
	}

	/**
	 * @return Returns the detailMessage.
	 */
	public String getDetailMessage() {
		return detailMessage;
	}

	/**
	 * @param detailMessage
	 *            The detailMessage to set.
	 */
	public void setDetailMessage(String detailMessage) {
		this.detailMessage = detailMessage;
	}

	/**
	 * @return Returns the jobName.
	 */
	public String getJobName() {
		return jobName;
	}

	/**
	 * @param jobName
	 *            The jobName to set.
	 */
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}

	/**
	 * @return Returns the status.
	 */
	public JobRuntimeStatus getStatus() {
		return status;
	}

	/**
	 * @param status
	 *            The status to set.
	 */
	public void setStatus(JobRuntimeStatus status) {
		this.status = status;
	}

}
